import React from "react";
// import React from "./react";


function App (){
  const [number, setNumber] = React.useState(0)


  React.useEffect(()=>{
    console.log('重新执行');
    let timer = setInterval(()=>{
      setNumber(number+1)
    },1000)

    return ()=>{
      console.log('清楚定时器')
      clearInterval(timer)
    }
  },[])

  return <div>
      <p>Counter: {number}</p>
    </div>
}
export default App